<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>属性选择器</title>
		<link rel="stylesheet" type="text/css" href="css/txt.css" />
		<script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>

		<table>
			<tr>
				<td abc="hello">1-1、hello</td>
				<td>1-2、world</td>
				<td id="tdgo">1-3、mldn</td>
			</tr>
			<tr>
				<td abc="hello">2-1、java</td>
				<td>2-2、jsp</td>
				<td>2-3、js</td>
			</tr>
			<tr>
				<td abc="hello" id="testtd">3-1、spark</td>
				<td>3-2、storm</td>
				<td>3-3、hadoop</td>
			</tr>
		</table>

	</body>

	<script type="text/javascript">
		$(function() {
			// 给指定元素属性id包含td的元素设置样式txt
			$("[id*=td]").attr("class","txt");

		});
	</script>

</html>